﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gasco.Business.Services
{
    public class PurchaseOrderNotSpecifiedException : Exception
    {

        public PurchaseOrderNotSpecifiedException()
            : base("In sale orders, You must specify parent purchase order.")
        {
        }
    }

    public class InvalidQuantityException : Exception
    {

        public InvalidQuantityException()
            : base("Quantity of sale orders must be lesser or equal to purchase order.")
        {
        }
    }

    public class PurchaseOrderNotFoundException : Exception
    {

        public PurchaseOrderNotFoundException()
            : base("Specified Purchase Order not found!")
        {
        }
    }

    public class ContactNameNotFoundException : Exception
    {
        public String ContactName { get; private set; }

        public ContactNameNotFoundException(string contactName)
            : base("Specified Contact Name Not Found!")
        {
            this.ContactName = contactName;
        }
    }

    public class OrderHasSaleOrdersException : Exception
    {
        public OrderHasSaleOrdersException()
            : base("Specified order has associated sale orders please delete them first.")
        {
        }
    }

    public class PurchaseOrderMustBeNullException : Exception
    {
        public PurchaseOrderMustBeNullException()
            : base("PurchaseOrderId must be null for purchase orders.")
        {
        }
    }

    public class ExpireAndCreateDateMismatch : Exception
    {
        public ExpireAndCreateDateMismatch()
            : base("Expire Date must be greater or equal to Create Date!")
        {
        }
    }

    public class DuplicatePlattException : Exception
    {
        public DuplicatePlattException()
            : base("Can not Insert two platts for same product in same day!")
        {
        }

    }

    public class BorderRequiredForSaleException : Exception
    {
        public BorderRequiredForSaleException()
            : base("Border must be specified for Sale Order.")
        {
        }
    }

    public class TotalLoadingQuantityMustEqualOrLessThanOrder : Exception
    {
        public TotalLoadingQuantityMustEqualOrLessThanOrder()
            : base("Total loading quantity must equal or less than order quantiry.")
        {
        }
    }

    public class OrderNameNotFoundException : Exception
    {
        public String OrderName { get; private set; }
        public OrderNameNotFoundException(string OrderName)
            : base("Order name not found !")
        {
            this.OrderName = OrderName;
        }
    }

    public class OrderNumberNotFoundException : Exception
    {
        public string OrderNumber { get; private set; }
        public OrderNumberNotFoundException(string OrderNumber)
            : base("Order number not found !")
        {
            this.OrderNumber = OrderNumber;
        }
    }

    public class DateMismatch : Exception
    {
        public DateMismatch()
            : base("Date Mismatch!")
        {
        }
    }

    public class BeforeDateEmpty : Exception
    {
        public BeforeDateEmpty()
            : base("Before Date Empty !")
        {

        }
    }




    public class DuplicateProduct : Exception
    {
        public DuplicateProduct()
            : base("Duplicate product name!")
        { }
    }


    public class DuplicateCmrNumber : Exception
    {
        public DuplicateCmrNumber()
            : base("Duplicate CrmNumber")
        { }
    }

    public class PurchaseAndSaleExpireDateMismatch : Exception
    {
        public PurchaseAndSaleExpireDateMismatch()
            : base("Sale.ExpireDate can not be greater than Purchase.ExpireDate")
        { }
    }

    public class DuplicateOrderException : Exception
    {
        public DuplicateOrderException()
            : base("OrderNumber and OrderName must be unique!")
        {
        }
    }

    public class InvalidOrderStatusException:Exception
    {
        public InvalidOrderStatusException():base("To Register Loading OrderStatus must be WaitingForLoading !")
        {}
    }

    public class LoadingDatelessThanOrderStartDate : Exception
    {
        public LoadingDatelessThanOrderStartDate()
            : base("Loaidng date less than order start date!")
        { }
    }
}
